package paritclecontainer2d;

public class SimpleEmiter extends Emiter {

	protected double decay;
	protected int speed;
	
	public SimpleEmiter(double decay, int speed){
		this.decay = decay;
		this.speed = speed;
	}
	
	@Override
	protected void decay(Particle particle) {
		double ttl = (particle.getTimeToLife()-decay);
		if(ttl <= 0){
			kill(particle);
		}
		else{
			particle.setTimeToLife(ttl);
		}
	}

	@Override
	protected void emit(Particle particle) {
		particle.setX(particle.getX()+speed);
	}

	public double getDecay() {
		return decay;
	}

	public void setDecay(double decay) {
		this.decay = decay;
	}

	public int getSpeed() {
		return speed;
	}

	public void setSpeed(int speed) {
		this.speed = speed;
	}

}
